using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

// 操作圆点
public class Point : BaseGraph
{
    public static List<Point> Caches;
    
    // 半径
    public float radius;
    // 位置
    public Vector3 pos;

    public Color color;

    public Point(bool isCtrl = true)
    {
        radius = 0.5f;
        pos = Vector3.zero;

        if (Point.Caches == null)
            Caches = new List<Point>();
        Caches.Add(this);

        if (isCtrl)
        {
            OnMouseIn += mouseIn;
            OnMouseOut += mouseOut;
        }
    }
    
    private void mouseIn()
    {
        color = QuadSetting.Instance.TestPointOverColor;
        Draw();
    }

    private void mouseOut()
    {
        color = QuadSetting.Instance.TestPointColor;
        Draw();
    }

    /// <summary>
    /// 绘制
    /// </summary>
    public override void Draw()
    {
        Handles.color = color;
        Handles.DrawSolidDisc(pos, Vector3.forward, radius);
    }
}
